package com.minimalist.common.entity.lindi.po;

import com.minimalist.common.config.mybatis.InsertFullColumnHandler;
import com.minimalist.common.config.mybatis.UpdateFullColumnHandler;
import com.minimalist.common.config.mybatis.bo.BaseEntity;
import com.mybatisflex.annotation.Table;

import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Objects;

/**
 * 林地指标交易平台_指标购买申请表 实体类。
 *
 * @author 11987
 * @since 2025-07-01
 */
@Table(value = "LINDI_PURCHASE_APPLICATION", onInsert = InsertFullColumnHandler.class, onUpdate = UpdateFullColumnHandler.class)
public class LindiPurchaseApplication extends BaseEntity implements Serializable{

    @Serial
    private static final long serialVersionUID = 1L;

    /**
     * 购买申请ID
     */
    private Long purchaseApplicationId;

    /**
     * 购买申请编号
     */
    private String purchaseApplicationCode;

    /**
     * 购买申请名称
     */
    private String purchaseApplicationName;

    /**
     * 购买申请状态
     */
    private String purchaseApplicationStatus;

    /**
     * 申请时间
     */
    private LocalDateTime applicationTime;

    // 构造函数
    public LindiPurchaseApplication() {
    }

    public LindiPurchaseApplication(Long purchaseApplicationId, String purchaseApplicationCode, String purchaseApplicationName, String purchaseApplicationStatus) {
        this.purchaseApplicationId = purchaseApplicationId;
        this.purchaseApplicationCode = purchaseApplicationCode;
        this.purchaseApplicationName = purchaseApplicationName;
        this.purchaseApplicationStatus = purchaseApplicationStatus;
    }

    public LindiPurchaseApplication(Long purchaseApplicationId, String purchaseApplicationCode, String purchaseApplicationName, String purchaseApplicationStatus, LocalDateTime applicationTime) {
        this.purchaseApplicationId = purchaseApplicationId;
        this.purchaseApplicationCode = purchaseApplicationCode;
        this.purchaseApplicationName = purchaseApplicationName;
        this.purchaseApplicationStatus = purchaseApplicationStatus;
        this.applicationTime = applicationTime;
    }

    // Getter和Setter方法
    public Long getPurchaseApplicationId() {
        return purchaseApplicationId;
    }

    public void setPurchaseApplicationId(Long purchaseApplicationId) {
        this.purchaseApplicationId = purchaseApplicationId;
    }

    public String getPurchaseApplicationCode() {
        return purchaseApplicationCode;
    }

    public void setPurchaseApplicationCode(String purchaseApplicationCode) {
        this.purchaseApplicationCode = purchaseApplicationCode;
    }

    public String getPurchaseApplicationName() {
        return purchaseApplicationName;
    }

    public void setPurchaseApplicationName(String purchaseApplicationName) {
        this.purchaseApplicationName = purchaseApplicationName;
    }

    public String getPurchaseApplicationStatus() {
        return purchaseApplicationStatus;
    }

    public void setPurchaseApplicationStatus(String purchaseApplicationStatus) {
        this.purchaseApplicationStatus = purchaseApplicationStatus;
    }

    public LocalDateTime getApplicationTime() {
        return applicationTime;
    }

    public void setApplicationTime(LocalDateTime applicationTime) {
        this.applicationTime = applicationTime;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        if (!super.equals(o)) return false;
        LindiPurchaseApplication that = (LindiPurchaseApplication) o;
        return Objects.equals(purchaseApplicationId, that.purchaseApplicationId) &&
                Objects.equals(purchaseApplicationCode, that.purchaseApplicationCode) &&
                Objects.equals(purchaseApplicationName, that.purchaseApplicationName) &&
                Objects.equals(purchaseApplicationStatus, that.purchaseApplicationStatus) &&
                Objects.equals(applicationTime, that.applicationTime);
    }

    @Override
    public int hashCode() {
        return Objects.hash(super.hashCode(), purchaseApplicationId, purchaseApplicationCode, purchaseApplicationName, purchaseApplicationStatus, applicationTime);
    }

    @Override
    public String toString() {
        return "LindiPurchaseApplication{" +
                "purchaseApplicationId=" + purchaseApplicationId +
                ", purchaseApplicationCode='" + purchaseApplicationCode + '\'' +
                ", purchaseApplicationName='" + purchaseApplicationName + '\'' +
                ", purchaseApplicationStatus='" + purchaseApplicationStatus + '\'' +
                ", applicationTime=" + applicationTime +
                '}';
    }

    // Builder模式
    public static Builder builder() {
        return new Builder();
    }

    public static class Builder {
        private Long purchaseApplicationId;
        private String purchaseApplicationCode;
        private String purchaseApplicationName;
        private String purchaseApplicationStatus;
        private LocalDateTime applicationTime;

        public Builder purchaseApplicationId(Long purchaseApplicationId) {
            this.purchaseApplicationId = purchaseApplicationId;
            return this;
        }

        public Builder purchaseApplicationCode(String purchaseApplicationCode) {
            this.purchaseApplicationCode = purchaseApplicationCode;
            return this;
        }

        public Builder purchaseApplicationName(String purchaseApplicationName) {
            this.purchaseApplicationName = purchaseApplicationName;
            return this;
        }

        public Builder purchaseApplicationStatus(String purchaseApplicationStatus) {
            this.purchaseApplicationStatus = purchaseApplicationStatus;
            return this;
        }

        public Builder applicationTime(LocalDateTime applicationTime) {
            this.applicationTime = applicationTime;
            return this;
        }

        public LindiPurchaseApplication build() {
            LindiPurchaseApplication application = new LindiPurchaseApplication(purchaseApplicationId, purchaseApplicationCode, purchaseApplicationName, purchaseApplicationStatus);
            application.setApplicationTime(applicationTime);
            return application;
        }
    }

}
